import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
import ApplyControl from '../views/ApplyControl.vue'
import DeskControl from '../views/DeskControl.vue'
import UserControl from '../views/UserControl.vue'
import ApplyDetial from '../views/ApplyDetial.vue'
import FremWork from '../views/fremwork'


Vue.use(VueRouter)

const routes = [
    {
        path: '/',
        name: 'index',
        // component: Home
        redirect: {name: 'Login'}
    },
    {
        path: '/login',
        name: 'Login',
        component: Login
    },
    {
        path: '/fremwork',
        name: '框架',
        component: FremWork,
        children: [
            {
                path: '/home',
                name: 'Home',
                component: Home,
                meta: {
                    requireAuth: true
                }
            },
            {
                path: '/applyControl',
                name: 'ApplyControl',
                component: ApplyControl,
                meta: {
                    requireAuth: true
                }
            },
            {
                path: '/applyControl/detial/:applyId',   //传参写法
                name: 'ApplyDetial',
                component: ApplyDetial,
                meta: {
                    requireAuth: true
                }
            },
            {
                path: '/deskControl',
                name: 'DeskControl',
                component: DeskControl,
                meta: {
                    requireAuth: true
                }
            },
            {
                path: '/userControl',
                name: 'UserControl',
                component: UserControl,
                meta: {
                    requireAuth: true
                }
            }
        ]
    }
]

const router = new VueRouter({
    mode: 'hash',
    base: process.env.BASE_URL,
    routes
})

export default router
